package com.txts.road.app.message.controller;

import com.txts.road.app.message.model.vo.QuickMessageVO;
import com.txts.road.app.message.service.QuickMessageService;
import com.txts.base.common.domain.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.txts.road.app.message.model.dto.QuickMessageDTO;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;


/**
 * 快捷用语前端控制层
 *
 * @author baoyr
 * @since 2025-07-17 10:43
 */
@Tag(name = "快捷用语接口")
@RestController
@RequestMapping("/api/v1/quick-message")
@RequiredArgsConstructor
public class QuickMessageController  {

    private final QuickMessageService quickMessageService;


    /**
     * 获取快捷用语
     */
    @Operation(summary = "获取快捷用语")
    @GetMapping("/quick-messages")
    public ResponseDTO<List<QuickMessageVO>> getQuickMessages() {
        return ResponseDTO.ok(quickMessageService.getQuickMessages());
    }

    /**
     * 添加快捷用语
     */
    @Operation(summary = "添加快捷用语")
    @PostMapping("/quick-message/add")
    public ResponseDTO<Boolean> addQuickMessage(@Valid @RequestBody QuickMessageDTO addDTO) {
        return ResponseDTO.ok(quickMessageService.addQuickMessage(addDTO));
    }

    /**
     * 删除快捷用语
     */
    @Operation(summary = "删除快捷用语")
    @DeleteMapping("/quick-message/{quickId}")
    public ResponseDTO<Boolean> deleteQuickMessage(@PathVariable Long quickId) {
        return ResponseDTO.ok(quickMessageService.deleteQuickMessage(quickId));
    }


}
